package cn.com.bdqn.controller;

import cn.com.bdqn.entity.OrdersLine;
import cn.com.bdqn.service.OrdersLineService;
import cn.com.bdqn.utils.ReturnData;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/ordersLine")
@Api(tags = "订单明细管理接口")
public class OrdersLineController {

    @Autowired
    private OrdersLineService ordersLineService;

    @Operation(summary = "根据订单编号查询相关订单明细信息")
    @PostMapping("/queryByOddOrderId")
    public ReturnData queryByOddOrderId(String oddOrderId){
        try {
            List<Map> ordersLines = ordersLineService.queryByOddOrderId(oddOrderId);
            return ReturnData.ok().put("ordersLines",ordersLines);
        }catch (Exception e){
            return ReturnData.currError("数据库异常");
        }
    }
}
